<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PlPN::Document - The document object</title>
<link rel="stylesheet" href="../PlPN.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#methods">METHODS</a></li>
	<li><a href="#copyright_and_licence">COPYRIGHT and LICENCE</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>PlPN::Document - The document object</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
        use PlPN qw(PN);
        
        my $doc = PN-&gt;GetCurrentDocument;
        my $title = $doc-&gt;GetTitle;
        
        # etc.</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Allows manipulation of Programmer's Notepad documents from Perl.</p>
<p>
</p>
<hr />
<h1><a name="methods">METHODS</a></h1>
<dl>
<dt><strong><a name="gettitle" class="item">GetTitle()</a></strong></dt>

<dd>
<p>Returns the title of the document (the text that appears in the tab).</p>
</dd>
<dt><strong><a name="getfilename" class="item">GetFileName()</a></strong></dt>

<dd>
<p>Returns the file name associated with the document.</p>
</dd>
<dt><strong><a name="getcurrentscheme" class="item">GetCurrentScheme()</a></strong></dt>

<dd>
<p>Returns the scheme associated with the document.</p>
</dd>
<dt><strong><a name="getscintillahwnd" class="item">GetScintillaHWND()</a></strong></dt>

<dd>
<p>Returns the handle of the Scintilla editor associated with the object.
Probably not very useful unless you're using a GUI package
(such as <em>Win32::GUI</em>).</p>
</dd>
<dt><strong><a name="getmodified" class="item">GetModified()</a></strong></dt>

<dd>
<p>Returns true if the document has been modified since the last time it was
saved; false otherwise.</p>
<p>More precisely, the reference action is the actual saving of the file to
disk, but the setting of a save point in the Scintilla object. However,
unless someone has been messing with the Scintilla object directly, the two
should happen at the same time.</p>
<p>The extensions interface, does however, permit messing with the Scintilla
object (see <a href="#getscintillahwnd">GetScintillaHWND</a> and <a href="#sendeditormessage">SendEditorMessage</a>), so it is
possible for an extension (including this one) to set a save point without
actually saving the file.</p>
</dd>
<dt><strong><a name="getwriteprotect" class="item">GetWriteProtect()</a></strong></dt>

<dd>
<p>Returns true if the document if write-protected (i.e., read-only); false
otherwise.</p>
<p>Note that this refers only to the status of the document object, and not to
the status of the associated file (although the two are usually connected).</p>
</dd>
<dt><strong><a name="getcansave" class="item">GetCanSave()</a></strong></dt>

<dd>
<p>Returns true if the document can be saved. For Programmer's Notepad, it can
be saved if it is associated with a valid filename.</p>
</dd>
<dt><strong><a name="save" class="item">Save($filename, $update = 1)</a></strong></dt>

<dd>
<p>Saves the file. If <code>$update</code> is true, it will update the UI; this includes
changing the tab text if necessary, setting a save point, and sending
<code>OnBeforeSave</code> and <code>OnAfterSave</code> events. Setting <code>$update</code> to a false
value basically means you're saving a copy that the UI doesn't need to know
about, perhaps a timed backups.</p>
<p>Returns true on success, false on failure.</p>
</dd>
<dt><strong><a name="sendeditormessage" class="item">SendEditorMessage($message, $wParam, $lParam)</a></strong></dt>

<dd>
<p>Sends a message to the associated Scintilla window.</p>
<p>See <a href="http://www.scintilla.org/ScintillaDoc.html">http://www.scintilla.org/ScintillaDoc.html</a> for information on
Scintilla messages and associated parameters. See
<a href="http://scintilla.hg.sourceforge.net/hgweb/scintilla/scintilla/file/tip/include/Scintilla.h">http://scintilla.hg.sourceforge.net/hgweb/scintilla/scintilla/file/tip/include/Scintilla.h</a>
for the values of the Scintilla message constants.</p>
</dd>
<dt><strong><a name="isvalid" class="item">IsValid()</a></strong></dt>

<dd>
<p>Returns true if the document object is valid, false otherwise. A document
object is invalid if the underlying document has been closed.</p>
</dd>
<dt><strong><a name="addeventsink" class="item">AddEventSink($sink)</a></strong></dt>

<dt><strong><a name="removeeventsink" class="item">RemoveEventSink($sink)</a></strong></dt>

<dd>
<p>Adds or removes a <a href="./DocumentEventSink.html">PlPN::DocumentEventSink</a> or
<a href="./TextEditorEventSink.html">PlPN::TextEditorEventSink</a>. You only need this
if you're writing your own event sink, you don't need it if you're using the
default event sink via <a href="./registerevent.html">PlPN::RegisterEvent</a>.</p>
</dd>
<dt><strong><a name="findnext" class="item">FindNext($options)</a></strong></dt>

<dd>
<p>Performs a search using the values from <code>$options</code>, a
<a href="./SearchOptions.html">PlPN::SearchOptions</a> object. It returns one of the
indicators exposed via the <code>:FindNextResult</code> tag in <a href="../PlPN.html">PlPN</a>. These
indicators are:</p>
<dl>
<dt><strong><a name="fnnotfound" class="item">fnNotFound</a></strong></dt>

<dt><strong><a name="fnfound" class="item">fnFound</a></strong></dt>

<dt><strong><a name="fnreachedstart" class="item">fnReachedStart</a></strong></dt>

<dt><strong><a name="fninvalidregex" class="item">fnInvalidRegex</a></strong></dt>

<dt><strong><a name="fninvalidsearch" class="item">fnInvalidSearch</a></strong></dt>

</dl>
</dd>
<dt><strong><a name="replace" class="item">Replace($options)</a></strong></dt>

<dd>
<p>Performs a search and replace using the values from <code>$options</code>, a
<a href="./SearchOptions.html">PlPN::SearchOptions</a> object. It returns true if a
match was found and replaced; false otherwise.</p>
</dd>
<dt><strong><a name="replaceall" class="item">ReplaceAll($options)</a></strong></dt>

<dd>
<p>Performs a search and replace all using the values from <code>$options</code>, a
<a href="./SearchOptions.html">PlPN::SearchOptions</a> object. It returns the number of
matches found and replaced.</p>
</dd>
<dt><strong><a name="close" class="item">Close($force = 0)</a></strong></dt>

<dd>
<p>Closes the document. If the document has not been changed since the last
save point, it will be closed. If the document has been changed, however,
the default behavior is to notify the user, who can then choose whether to
close the file, save and close the file, or keep the file open. Setting
<code>$force</code> to a true value will override this default behavior and close the
file without prompting the user.</p>
</dd>
<dt><strong><a name="activate" class="item">Activate()</a></strong></dt>

<dd>
<p>Activates the document, including bringing the document window to the front
of other document windows and shifting focus to it.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="copyright_and_licence">COPYRIGHT and LICENCE</a></h1>
<p>Copyright (c) 2012 Sean Healy. All rights reserved.</p>
<p>This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.</p>

</body>

</html>
